library _;

import 'package:flutter/material.dart';
import 'package:flutter_app/Const/IFinal.dart';
import 'package:flutter_app/Model/UserModel.dart';
import 'package:flutter_app/Page/Main/Login/main.dart';
import 'package:flutter_app/Util/EncodeUtils.dart';
import 'package:flutter_app/View/MyViews.dart';
import 'package:flutter_yfree/YFree.dart';

part 'controller.dart';

part 'view.dart';

class RegisterPage extends YPage {
  bool isSelectProtocol = false, isShowPassword = false;
  String? codeParams;

  String hint_loginname = "请输入用户名", hint_password1 = "请输入密码", hint_password2 = "请再次输入密码", hint_code = "请输入验证码";
  final textController_loginname = TextEditingController(), textController_password1 = TextEditingController(), textController_password2 = TextEditingController(), textController_code = TextEditingController();

  final focusNode_loginname = FocusNode();

  @override
  void yOnCreate() {
    focusNode_loginname.addListener(() {
      if (!focusNode_loginname.hasFocus) controller_refreshCode();
    });
  }

  @override
  void yOnDestory() {
    textController_loginname.dispose();
    textController_password1.dispose();
    textController_password2.dispose();
    textController_code.dispose();
  }

  @override
  Widget yBuild(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        view_topBar(),
        Container(
          margin: EdgeInsets.fromLTRB(20, 40, 20, 0),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text("亲，欢迎注册", style: TextStyle(fontSize: 30)),
              YSpacer(height: 10),
              view_title(),
              YSpacer(height: 30),
              view_main(),
              YSpacer(height: 5),
              view_protocol(),
            ],
          ),
        ),
      ],
    );
  }
}
